package com.nbsaas.boot.controller.user;

import com.nbsaas.boot.rest.annotations.SearchData;
import com.nbsaas.boot.rest.response.PageResponse;
import com.nbsaas.boot.user.api.apis.UserLoginLogApi;
import com.nbsaas.boot.user.api.domain.request.UserLoginLogSearch;
import com.nbsaas.boot.user.api.domain.simple.UserLoginLogSimple;
import com.nbsaas.boot.utils.UserUtils;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import jakarta.annotation.Resource;

/**
 * 对外控制器
 */
@RequiresAuthentication
@RestController
@RequestMapping("/userLoginLog")
public class UserLoginLogController {


    @Resource
    private UserLoginLogApi userLoginLogApi;


     @SearchData
    @RequestMapping("/search")
    public PageResponse<UserLoginLogSimple> search(@RequestBody UserLoginLogSearch request) {
         request.setUserId(UserUtils.user().getId());
        return userLoginLogApi.search(request);
    }
}